import QtQuick 2.0
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4

import "../../../commonUI"
import "../../../basic"

// 音质与下载
Item {
    anchors.left: parent.left
    anchors.right: parent.right
    height: 830
    Label {
        id: toneTitleLabel
        text: qsTr("音质与下载")
        font.pixelSize: 22
        font.bold: true
        font.family: BasicConfig.heiTiFont
        anchors.left: parent.left
        color: "white"
    }

    // 音质播放设置与音质下载顺序
    Column {
        id: toneCol1
        anchors.left: toneTitleLabel.left
        anchors.right: parent.right
        anchors.top: toneTitleLabel.top
        anchors.leftMargin: 150
        spacing: 40
        Repeater {
            model: ["音质播放设置", "音质下载设置"]
            Item {
                anchors.left: parent.left
                anchors.right: parent.right
                height: 150
                ExclusiveGroup { id:group }
                Label {
                    id: tonePlayLabel
                    text: modelData
                    font.pixelSize: 20
                    font.bold: true
                    font.family: BasicConfig.heiTiFont
                    anchors.left: parent.left
                    color: "white"
                }
                Grid {
                    rows: 3
                    columns: 3
                    rowSpacing: 30
                    columnSpacing: 60
                    anchors.left: tonePlayLabel.right
                    anchors.top: tonePlayLabel.top
                    anchors.right: parent.right
                    anchors.leftMargin: 30
                    Repeater {
                        model: [ "沉静环绕声","超声母带","高清臻音","高解析度无损","无损","极高","标准" ]
                        CustomRadioButton {
                            isSelect: index === 4
                            contentText: modelData
                            exclusiveGroup: group
                        }
                    }
                }
            }
        }
        Label {
            id: knowToneLabel
            text: qsTr("了解音质>")
            font.pixelSize: 20
            anchors.left: parent.left
            color: "#647bb8"
            font.family: BasicConfig.commFont
            MouseArea {
                anchors.fill: parent
                hoverEnabled: true
                onEntered: {
                    cursorShape = Qt.PointingHandCursor
                }
                onExited: {
                    cursorShape = Qt.ArrowCursor
                }
                onClicked: Qt.openUrlExternally("https://blog.csdn.net/cpp_learner")
            }
        }
        CustomFolderSet {
            id: floderItemRoot
            anchors.left: parent.left
            anchors.right: parent.right
            height: 60
            text: "下载目录"
        }
        CustomFolderSet {
            id: saveItemRoot
            anchors.left: parent.left
            anchors.right: parent.right
            height: 60
            text: "缓存目录"
        }
        Row {
            id: maxMemoryRow
            anchors.left: parent.left
            anchors.right: parent.right
            spacing: 20
            Label {
                id: maxMemoryLabel
                text: qsTr("缓存最大占用")
                font.pixelSize: 20
                color: "#ddd"
                font.family: BasicConfig.commFont
            }
            Slider {
                id: memorySlider
                value: 1
                maximumValue: 10
                minimumValue: 0
                width: 300
                height: 14
                anchors.verticalCenter: maxMemoryLabel.verticalCenter
                style: SliderStyle {
                    groove: Rectangle {
                        color: "#2b2b30"
                        height: control.height / 2
                        width: control.width
                        radius: height / 2
                        clip: true
                        Rectangle {
                            color: "#eb4d44"
                            anchors.top: parent.top
                            anchors.bottom: parent.bottom
                            anchors.left: parent.left
                            width: parent.width * memorySlider.value / memorySlider.maximumValue
                        }
                    }
                }
            }
            Label {
                text: memorySlider.value.toFixed(1) + "G"
                font.pixelSize: 20
                color: "#ddd"
                font.family: BasicConfig.commFont
            }
            // 清除缓存
            Rectangle {
                id: clearMemoryRect
                height: 30
                width: 100
                radius: 15
                anchors.verticalCenter: maxMemoryLabel.verticalCenter
                color: "transparent"
                border.width: 1
                border.color: BasicConfig.fieldBgBordColor
                Label {
                    text: qsTr("清除缓存")
                    font.pixelSize: 20
                    font.family: BasicConfig.commFont
                    anchors.centerIn: parent
                    color: "white"
                }
                MouseArea {
                    anchors.fill: parent
                    hoverEnabled: true
                    onEntered: {
                        parent.color = BasicConfig.commGray
                        cursorShape = Qt.PointingHandCursor
                    }
                    onExited: {
                        parent.color = "transparent"
                        cursorShape = Qt.ArrowCursor
                    }
                }
            }
        }
        Column {
            spacing: 30
            anchors.left: parent.left
            anchors.right: parent.right
            Repeater {
                model: ["音乐命名格式","文件智能分类"]
                Item {
                    anchors.left: parent.left
                    anchors.right: parent.right
                    height: 25
                    Label {
                        id: subTitleLabel
                        text: modelData
                        font.pixelSize: 20
                        font.family: BasicConfig.commFont
                        anchors.verticalCenter: parent.verticalCenter
                        anchors.left: parent.left
                        color: "white"
                    }
                    ExclusiveGroup { id:singGroup }
                    Row {
                        spacing: 40
                        anchors.left: subTitleLabel.right
                        anchors.leftMargin: 15
                        anchors.verticalCenter: subTitleLabel.verticalCenter
                        Repeater {
                            model: index === 0 ? ["不分文件夹","按歌手分文件夹","按歌手/专辑分文件夹"] : ["歌曲名","歌曲歌手名","歌曲"]
                            CustomRadioButton {
                                contentText: modelData
                                exclusiveGroup: singGroup
                            }
                        }
                    }
                }
            }
        }
    }
    CustomPliteLine { }
}
